<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<strong><%@ taglib prefix="c"
                   uri="http://java.sun.com/jsp/jstl/core" %></strong>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>订单信息修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/xAdmin/css/font.css">
    <link rel="stylesheet" href="/xAdmin/css/xadmin.css">
    <link rel="stylesheet" href="/xAdmin/lib/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/xAdmin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/xAdmin/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form method="post" class="layui-form" lay-filter="example">
            <div class="layui-form-item">
                <label for="orderid" class="layui-form-label">
                    订单号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="orderid" name="orderid" required="" lay-verify="required" disabled="disabled"
                           autocomplete="off" class="layui-input" value="${order.orderid}">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label for="address" class="layui-form-label">
                        收货地址
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="address" name="address" required="" lay-verify="required" disabled="disabled"
                               autocomplete="off" class="layui-input" value="${order.address}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="couriercompany" class="layui-form-label">
                    快递公司
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="couriercompany" name="couriercompany" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="${order.couriercompany}">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="couriernumber" class="layui-form-label">
                    快递单号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="couriernumber" name="couriernumber" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="${order.couriernumber}">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="deliveryTime" class="layui-form-label">
                    发货时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="deliveryTime" name="deliveryTime" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="${order.deliveryTime}">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="add" class="layui-form-label">
                </label>
                <button type="button" class="layui-btn" lay-filter="add"  onclick="Issubmit()">
                    确定
                </button>
            </div>

        </form>
    </div>
</div>
<script>

    layui.use(['form','laydate'], function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#deliveryTime'
            ,type: 'datetime'
            ,eventElem: '#deliveryTime'
            ,trigger: 'click'
        });
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
    });


    function Issubmit(){
        var orderid =  $('#orderid').val();
        var couriercompany =  $('#couriercompany').val();
        var couriernumber= $('#couriernumber').val();
        var deliveryTime =  $('#deliveryTime').val();
        var data = {
            orderid:orderid,
            couriercompany:couriercompany,
            couriernumber:couriernumber,
            deliveryTime:deliveryTime
            };


        $.ajax({
            url:"/tBaOrder/update",
            type:'post',
            dataType:'text',
            contentType: 'application/json',
            data:JSON.stringify(data),
            timeout:2000,
            success:function(data){
                // console.log( JSON.parse( data ));
                var datas =JSON.parse( data );
                var layer = parent.layui.layer;
                if(datas.oper_res)
                    layer.msg('操作成功!',{icon:1,time:1000});
                else
                    layer.msg('操作失败!',{icon:1,time:1000});
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            },
            error:function () {
                var layer = parent.layui.layer;
                layer.msg("操作失败",{icon:1,time:1000});
            }
        })
    }

</script>

</body>

</html>
